Skip to content

Conversation

@jsiirola
Copy link
Member

@jsiirola jsiirola commented Jan 9, 2026

Fixes # .

Summary/Motivation:

This PR makes two fundamental changes to the StreamIndenter:

  • rely on (3) regular expressions to handle the indentation instead of breaking apart and piecing back together the strings
  • change the implementation so that nested StreamIndenter instances run with constant overhead (instead of linear in the number of nested indenters)

Changes proposed in this PR:

  • switch to using re for inserting the indentation
  • add improved special-case handling for blank lines (so that we do not add unnecessary whitespace into blank lines)
  • make nested indenters collect all indentation and then write directly to the underlying (unindented) output stream
  • improve testing

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.43%. Comparing base (c9ebf1a) to head (de6bcee).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3813   +/-   ##
=======================================
  Coverage   89.43%   89.43%           
=======================================
  Files         906      906           
  Lines      105445   105457   +12     
=======================================
+ Hits        94307    94320   +13     
+ Misses      11138    11137    -1     
Flag Coverage Δ
builders 29.14% <18.86%> (-0.01%) ⬇️
default 86.05% <84.90%> (?)
expensive 35.76% <18.86%> (?)
linux 86.74% <84.90%> (-2.46%) ⬇️
linux_other 86.74% <84.90%> (-0.01%) ⬇️
osx 82.92% <84.90%> (+<0.01%) ⬆️
win 85.00% <94.33%> (+<0.01%) ⬆️
win_other 85.00% <94.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blnicho blnicho self-requested a review January 13, 2026 19:46
@blnicho blnicho merged commit 5de7031 into Pyomo:main Jan 19, 2026
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants